/*!
 * \file nuAllocator.h
 * \brief Nude's allocator module.
 * \author Nus
 * \date 2008/02/16, 21:14
 */

#ifndef __NUALLOCATOR_H__
#define __NUALLOCATOR_H__

#include "Allocator.h"
#include "Singleton.h"

//! \brief Change to Nude allocator.
#define ALLOC_NUDE \
ChangeMemory chg(nuAllocator::getInstance()->getNudeAlloc())

//! \brief Change to resource allocator.
#define ALLOC_RES \
ChangeMemory chg(nuAllocator::getInstance()->getResAlloc())

/*!
 * \class nuAllocator
 * \brief Allocator module.
 */
class nuAllocator : public Singleton< nuAllocator >
{
  DEFINE_SINGLETON(nuAllocator);

public:
  //! \brief Get Nude allocator.
  Allocator* getNudeAlloc(void) const {
    return mpNudeAlloc;
  }

  //! \brief Get resource allocator.
  Allocator* getResAlloc(void) const {
    return mpResAlloc;
  }

protected:
  // None...

private:
  Allocator* mpNudeAlloc;         //!< Nude allocator.
  Allocator* mpResAlloc;          //!< Resource allocator.

  //! \brief Default constructor.
  nuAllocator();
  
  //! \brief Default destructor.
  ~nuAllocator();

};

#endif
